package com.smartphonedev.function;

import android.content.Context;
import android.media.MediaPlayer;

public class Ringtones {
	private static MediaPlayer mp = null;

	// Always play
	public static void play(Context context, int resource) {
		stop(context);
		mp = MediaPlayer.create(context, resource);
		mp.setLooping(true);
		mp.start();
		mp.stop();
	}

	// Play and then stop
	public static void play2(Context context, int resource) {
		mp = MediaPlayer.create(context, resource);
		mp.start();
	}
	// Stop
	public static void stop(Context context) {
		if (mp != null) {
			mp.stop();
			mp.release();
			mp=null;
		}
	}
}